package com.beigai.imessage.session;

import com.beigai.imessage.server.UserSession;
import com.beigai.imessage.user.dto.UserInfo;

/**
 * Created by xxl on 2017/5/18.
 */
public class CurrentUserSession {
    /**
     * 声明局部线程变量
     */
    private static ThreadLocal<UserSession> currentUser = new ThreadLocal<UserSession>();


    /**
     * 设置当前用户对象
     *
     * @param user 用户值对象
     */
    public static void set(UserSession user) {
        currentUser.set(user);
    }

    /**
     * 获取当前用户对象
     *
     * @return 当前用户对象
     */
    public static UserSession get() {
        return currentUser.get();
    }

    /**
     * 移除
     */
    public static void remove(){
        currentUser.remove();
    }

}
